package mmusimulator;

/**
 *
 * @author Michal
 */
public class Simulator {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       
        System.out.println("INFO: Zavádím simulátor MMU");
        
        System.out.println("INFO: Vytvářím PC");
        System.out.println("--------------------------------------------");
        PC pocitac = new PC();
                 
    }
    /*POMOCNÉ METODY*/
    
    public static byte[] decimalToBinaryArray(long decimalNumber){
        
        byte[] adr = new byte[32];
        
        String s = Long.toBinaryString((int)decimalNumber);
        String[] cArray = s.split("(?!^)");
        for (int i = cArray.length -1 ; i >= 0 ; i--)
        {
                adr[i] = Byte.parseByte(cArray[(cArray.length -1) - i]);
               // System.out.printf(cArray[i]);                  
        }
        //System.out.println("");
           
        return adr;
    }
    
   
    public static long getBitRange(int bits){      
        return (long)Math.pow(2, bits);
    }
    
    public static long binaryArrayToDec(byte[] array){
        
        int value = 0;
        
        for (int i = 0; i < array.length;i++){
            value += (long)array[i]*(long)Math.pow(2, i);           
        }
        
        return value;
        
    }
    
     public static void printArray(byte[] array) {
        for(int i=array.length-1; i >= 0; i-- )
            System.out.print(array[i]);
        System.out.println("");
    }
    
}
